const DataLookController = require("../controller/DataLookController.js");
const express = require("express");
const router = express.Router();
const dataLookController = new DataLookController();
// 引入认证中间件（根据实际需求添加）
// const authMiddleware = require("../middleware/authMiddleware.js");

// 1. 获取当日营业额（支持?date=2025-10-01参数指定日期）
router.get(
  "/today-sales",
  dataLookController.getTodaySales.bind(dataLookController)
);

// 2. 获取当日订单数（支持?date=2025-10-01参数指定日期）
router.get(
  "/today-orders",
  dataLookController.getTodayOrders.bind(dataLookController)
);

// 3. 获取库存警告
router.get(
  "/inventory-warning",
  dataLookController.getInventoryWarningCount.bind(dataLookController)
);

// 4. 获取待采购情况
router.get(
  "/pending-procurement",
  dataLookController.getPendingProcurement.bind(dataLookController)
);

// 5. 获取每日用餐人数趋势（支持?startDate=2025-10-01&endDate=2025-10-14参数，默认过去14天）
router.get(
  "/dining-count-trend",
  dataLookController.getDiningCountTrend.bind(dataLookController)
);

// 5. 每日用餐人数趋势（ECharts折线图专用）
router.get(
  "/dining-trend-echarts",
  dataLookController.getDiningCountTrendEcharts.bind(dataLookController)
);

// 6. 营收趋势（默认最近7天，支持日期区间参数）
router.get(
  "/revenue-trend",
  dataLookController.getRevenueTrend.bind(dataLookController)
);

// 7. 采购物品分类统计（适配ECharts饼状图）
router.get(
  "/purchase-category-stat",
  dataLookController.getPurchaseCategoryStat.bind(dataLookController)
);

// 8. 采购成本分析（X轴：类别，Y轴：总金额）
router.get(
  "/purchase-cost-analysis",
  dataLookController.getPurchaseCostAnalysis.bind(dataLookController)
);

// 9. 月度经营分析对比（一年内每月营收、成本、利润）
router.get(
  "/monthly-business-analysis",
  dataLookController.getMonthlyBusinessAnalysis.bind(dataLookController)
);

// 10. 最近活动（用户操作日志）
router.get(
  "/recent-activities",
  dataLookController.getRecentActivities.bind(dataLookController)
);

module.exports = router;
